package com.ruoyi.project.ping.controller;

import com.ruoyi.project.mydo.detail.domain.MydoJobDetail;
import com.ruoyi.project.mydo.mydojob.domain.MydoJob;
import com.ruoyi.project.ping.service.PingService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.List;
@CrossOrigin
@Controller
@RequestMapping("/ping")
public class PingController {

    @Autowired
    PingService pingService;

    @RequestMapping("/selectJob")
    @ResponseBody
    public List<MydoJobDetail> selectJob(String entranceId,String exitId){
        MydoJob mydoJob = new MydoJob();
        mydoJob.setEntranceId(entranceId);
        mydoJob.setExitId(exitId);
        List<MydoJobDetail> jobDetails;
        if("2016".equals(exitId) || "2017".equals(exitId) ||"2018".equals(exitId)){
             jobDetails= pingService.selectJobOut(mydoJob);
        }else {
             jobDetails= pingService.selectJob(mydoJob);
        }

       return jobDetails;

    }

}
